﻿Imports System.Threading

Namespace Sample
    Module ProfilerSample
        Sub Main()
            Console.WriteLine("Do Main.")
            Dim t1 As New Thread(AddressOf SleepAsSeconds)
            t1.Start(2)
            Dim t2 As New Thread(AddressOf SleepAsSeconds)
            t2.Start(1)
            Dim t3 As New Thread(AddressOf SleepAsSeconds)
            t3.Start(3)
        End Sub

        Private Sub SleepAsSeconds(ByVal s As Integer)
            SleepAsSecondsInner(s * 10)
        End Sub

        Private Sub SleepAsSecondsInner(ByVal s As Integer)
            Thread.Sleep(100)
            If s > 0 Then
                SleepAsSecondsInner(s - 1)
            End If
        End Sub
    End Module
End Namespace
